#!/usr/bin/env python


from os import system
import curses



def get_param(prompt_string):
    screen.clear()
    screen.border(0)
    screen.addstr(2, 2, prompt_string)
    screen.refresh()
    input = screen.getstr(10, 10, 60)
    return input

def execute_cmd(cmd_string):
    system("clear")
    system(cmd_string)
    
def Exit():
    num = 0
    while num != ord('4'):
            screen3 = curses.initscr()
            screen3.clear()
            screen3.border(0)
            screen3.addstr(2, 2, "Please enter a number...")
            screen3.addstr(4, 4, "1 - Log Out")
            screen3.addstr(5, 4, "2 - Restart System")
            screen3.addstr(6, 4, "3 - Power off System")
            screen3.addstr(8, 4, "4 - Back")
            screen3.refresh()
            num = screen3.getch()
            if num == ord('1'):
                system("clear")
                exit()
            elif num == ord('2'):
                execute_cmd("shutdown -r now")
            elif num == ord('3'):
                execute_cmd("shutdown -p now")
            curses.endwin()

def Cash():
    num = 0
    while num != ord('4'):
            screen3 = curses.initscr()
            screen3.clear()
            screen3.border(0)
            screen3.addstr(2, 2, "Please enter a number...")
            screen3.addstr(4, 4, "1 - Log Out")
            screen3.addstr(5, 4, "2 - Restart System")
            screen3.addstr(6, 4, "3 - Power off System")
            screen3.addstr(8, 4, "4 - Back")
            screen3.refresh()
            num = screen3.getch()
            if num == ord('1'):
                system("clear")
                exit()
            elif num == ord('2'):
                execute_cmd("shutdown -r now")
            elif num == ord('3'):
                execute_cmd("shutdown -p now")
            curses.endwin()

class MainScreen():
    x = 0
    while x != ord('4'):
        #curses.color_pair(COLOR_GREY)
        screen = curses.initscr()
        screen.clear()
        #curses.initscr()
        curses.start_color()
        curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
        screen.bkgd(' ', curses.color_pair(1))
        screen.clear()
        screen.border(0)
        screen.addstr(2, 2, "Please enter a number...")
        screen.addstr(4, 4, "1 - Cash")
        screen.addstr(5, 4, "2 - Inventory")
        screen.addstr(7, 4, "3 - Exit")
        screen.refresh()

        x = screen.getch()

        if x == ord('1'):
            pass
        if x == ord('2'):
            pass
        if x == ord('3'):
            Exit()
    curses.endwin()


